\hypertarget{posix__tests_8c}{}\section{posix/posix\+\_\+tests.c File Reference}
\label{posix__tests_8c}\index{posix/posix\+\_\+tests.\+c@{posix/posix\+\_\+tests.\+c}}


fatfs test utilities with user interface  


{\ttfamily \#include \char`\"{}user\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}fatfs.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}lib/time.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}lib/stringsup.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}printf/mathio.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}posix.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}posix\+\_\+tests.\+h\char`\"{}}\\*
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{posix__tests_8c_aeca034f67218340ecb2261a22c2f3dcd}{B\+U\+F\+S\+I\+ZE}~512
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{posix__tests_8c_ae59f48db88ed3bb8f9c549a7fbe9717d}{posix\+\_\+help} (int full)
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_a36d7c93fa658c992f9a881b89bb7f0af}{posix\+\_\+tests} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\begin{DoxyCompactList}\small\item\em P\+O\+S\+IX tests. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} long \hyperlink{posix__tests_8c_aeff1a094f806e4de30ef181e9a09cbe4}{cat} (char $\ast$name, int dopage)
\begin{DoxyCompactList}\small\item\em Display the contents of a file. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} long \hyperlink{posix__tests_8c_aa20d1cbe580573b96d08f9429a08fcd3}{copy} (char $\ast$from, char $\ast$to)
\begin{DoxyCompactList}\small\item\em Copy a file. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_ad8b824040392b9b3a34fed57d72a1313}{hexdump} (char $\ast$name, int dopage)
\begin{DoxyCompactList}\small\item\em hex listing of file with paging, \char`\"{}q\char`\"{} exits \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_ad6ce57bb64ab0fd7f91d04079fc4b070}{setpage} (int count)
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_a568ac783ed7c976d2832966dcbce607c}{testpage} (int count)
\begin{DoxyCompactList}\small\item\em Used to page output of functions like cat, hexdump, etc. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_a573eb4f7de945139101e2cfb59111722}{ls\+\_\+info} (char $\ast$name, int verbose)
\begin{DoxyCompactList}\small\item\em list one file \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{posix__tests_8c_ad6e0550e9557209680b1640c814746d8}{ls} (char $\ast$name, int verbose)
\begin{DoxyCompactList}\small\item\em Directory listing. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} long \hyperlink{posix__tests_8c_a0e04c0a3e471dd3212246ad0e0f710ea}{logfile} (char $\ast$name, char $\ast$str)
\begin{DoxyCompactList}\small\item\em Log string to a file. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{send_8c_a273cf69d639a59973b6019625df33e30}{uint16\+\_\+t} \hyperlink{posix__tests_8c_a8d4059ff64356316a5f13d16cdd90fb5}{sum} (char $\ast$name)
\begin{DoxyCompactList}\small\item\em sum of a file with 16bit hex and integer results \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} long \hyperlink{posix__tests_8c_a759815811bc60d82eba7fa71442b9d9c}{upload} (char $\ast$name)
\begin{DoxyCompactList}\small\item\em Capture an A\+S\+C\+II file to sdcard First blank line exits capture. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static int \hyperlink{posix__tests_8c_a8103355735500cb8d1c1eea35e352cda}{\+\_\+pagesize} = 25
\begin{DoxyCompactList}\small\item\em Used to page output of functions like cat, hexdump, etc. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
fatfs test utilities with user interface 

\begin{DoxyParagraph}{Copyright \copyright{} 2014-\/2017 Mike Gore, All rights reserved. G\+PL License}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\href{http://github.com/magore/hp85disk}{\tt http\+://github.\+com/magore/hp85disk} 

\href{http://github.com/magore/hp85disk/COPYRIGHT.md}{\tt http\+://github.\+com/magore/hp85disk/\+C\+O\+P\+Y\+R\+I\+G\+H\+T.\+md} for specific Copyright details
\end{DoxySeeAlso}
\begin{DoxyParagraph}{You are free to use this code under the terms of G\+PL}
please retain a copy of this notice in any code you use it in.
\end{DoxyParagraph}
This is free software\+: you can redistribute it and/or modify it under the terms of the G\+NU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but W\+I\+T\+H\+O\+UT A\+NY W\+A\+R\+R\+A\+N\+TY; without even the implied warranty of M\+E\+R\+C\+H\+A\+N\+T\+A\+B\+I\+L\+I\+TY or F\+I\+T\+N\+E\+SS F\+OR A P\+A\+R\+T\+I\+C\+U\+L\+AR P\+U\+R\+P\+O\+SE. See the G\+NU General Public License for more details.

You should have received a copy of the G\+NU General Public License along with this program. If not, see \href{http://www.gnu.org/licenses/}{\tt http\+://www.\+gnu.\+org/licenses/}. 

\subsection{Macro Definition Documentation}
\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!B\+U\+F\+S\+I\+ZE@{B\+U\+F\+S\+I\+ZE}}
\index{B\+U\+F\+S\+I\+ZE@{B\+U\+F\+S\+I\+ZE}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{B\+U\+F\+S\+I\+ZE}{BUFSIZE}}]{\setlength{\rightskip}{0pt plus 5cm}\#define B\+U\+F\+S\+I\+ZE~512}\hypertarget{posix__tests_8c_aeca034f67218340ecb2261a22c2f3dcd}{}\label{posix__tests_8c_aeca034f67218340ecb2261a22c2f3dcd}


Definition at line 43 of file posix\+\_\+tests.\+c.



Referenced by copy().



\subsection{Function Documentation}
\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!cat@{cat}}
\index{cat@{cat}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{cat(char $\ast$name, int dopage)}{cat(char *name, int dopage)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} long cat (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{int}]{dopage}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_aeff1a094f806e4de30ef181e9a09cbe4}{}\label{posix__tests_8c_aeff1a094f806e4de30ef181e9a09cbe4}


Display the contents of a file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em name} & file name. \\
\hline
\mbox{\tt in}  & {\em option} & --p page display \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void. 
\end{DoxyReturn}


Definition at line 259 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!copy@{copy}}
\index{copy@{copy}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{copy(char $\ast$from, char $\ast$to)}{copy(char *from, char *to)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} long copy (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{from, }
\item[{char $\ast$}]{to}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_aa20d1cbe580573b96d08f9429a08fcd3}{}\label{posix__tests_8c_aa20d1cbe580573b96d08f9429a08fcd3}


Copy a file. 


\begin{DoxyItemize}
\item Credit\+: part of Fat\+Fs avr example project (C)ChaN, 2013. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em from} & source file. \\
\hline
\mbox{\tt in}  & {\em to} & destination file. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bytes written 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 302 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!hexdump@{hexdump}}
\index{hexdump@{hexdump}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{hexdump(char $\ast$name, int dopage)}{hexdump(char *name, int dopage)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int hexdump (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{int}]{dopage}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_ad8b824040392b9b3a34fed57d72a1313}{}\label{posix__tests_8c_ad8b824040392b9b3a34fed57d72a1313}


hex listing of file with paging, \char`\"{}q\char`\"{} exits 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & file to hexdump  void \\
\hline
\end{DoxyParams}


Definition at line 363 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!logfile@{logfile}}
\index{logfile@{logfile}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{logfile(char $\ast$name, char $\ast$str)}{logfile(char *name, char *str)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} long logfile (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{char $\ast$}]{str}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a0e04c0a3e471dd3212246ad0e0f710ea}{}\label{posix__tests_8c_a0e04c0a3e471dd3212246ad0e0f710ea}


Log string to a file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em name} & name of file to create. \\
\hline
\mbox{\tt in}  & {\em str} & string containing file contents. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size of string, or 0 on error 
\end{DoxyReturn}


Definition at line 600 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!ls@{ls}}
\index{ls@{ls}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{ls(char $\ast$name, int verbose)}{ls(char *name, int verbose)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int ls (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{int}]{verbose}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_ad6e0550e9557209680b1640c814746d8}{}\label{posix__tests_8c_ad6e0550e9557209680b1640c814746d8}


Directory listing. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em path} & file name or directory \\
\hline
\mbox{\tt in}  & {\em option} & -\/l for detail \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of files 
\end{DoxyReturn}


Definition at line 517 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!ls\+\_\+info@{ls\+\_\+info}}
\index{ls\+\_\+info@{ls\+\_\+info}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{ls\+\_\+info(char $\ast$name, int verbose)}{ls_info(char *name, int verbose)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int ls\+\_\+info (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{int}]{verbose}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a573eb4f7de945139101e2cfb59111722}{}\label{posix__tests_8c_a573eb4f7de945139101e2cfb59111722}


list one file 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em path} & file name or directory \\
\hline
\mbox{\tt in}  & {\em verbose} & 1 = detail, 0 = name only \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 on success 0 on fail 
\end{DoxyReturn}


Definition at line 465 of file posix\+\_\+tests.\+c.



Referenced by ls().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!posix\+\_\+help@{posix\+\_\+help}}
\index{posix\+\_\+help@{posix\+\_\+help}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{posix\+\_\+help(int full)}{posix_help(int full)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void posix\+\_\+help (
\begin{DoxyParamCaption}
\item[{int}]{full}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_ae59f48db88ed3bb8f9c549a7fbe9717d}{}\label{posix__tests_8c_ae59f48db88ed3bb8f9c549a7fbe9717d}


Definition at line 46 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests(), and user\+\_\+help().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!posix\+\_\+tests@{posix\+\_\+tests}}
\index{posix\+\_\+tests@{posix\+\_\+tests}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{posix\+\_\+tests(int argc, char $\ast$argv[])}{posix_tests(int argc, char *argv[])}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int posix\+\_\+tests (
\begin{DoxyParamCaption}
\item[{int}]{argc, }
\item[{char $\ast$}]{argv\mbox{[}$\,$\mbox{]}}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a36d7c93fa658c992f9a881b89bb7f0af}{}\label{posix__tests_8c_a36d7c93fa658c992f9a881b89bb7f0af}


P\+O\+S\+IX tests. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em agc} & cont of arguments\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 The ruturn code indicates a command matched. 

0 if no rules matched 
\end{DoxyReturn}


Definition at line 84 of file posix\+\_\+tests.\+c.



Referenced by user\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!setpage@{setpage}}
\index{setpage@{setpage}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{setpage(int count)}{setpage(int count)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int setpage (
\begin{DoxyParamCaption}
\item[{int}]{count}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_ad6ce57bb64ab0fd7f91d04079fc4b070}{}\label{posix__tests_8c_ad6ce57bb64ab0fd7f91d04079fc4b070}


Definition at line 424 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!sum@{sum}}
\index{sum@{sum}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{sum(char $\ast$name)}{sum(char *name)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf uint16\+\_\+t} sum (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a8d4059ff64356316a5f13d16cdd90fb5}{}\label{posix__tests_8c_a8d4059ff64356316a5f13d16cdd90fb5}


sum of a file with 16bit hex and integer results 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & file to sum  void \\
\hline
\end{DoxyParams}


Definition at line 626 of file posix\+\_\+tests.\+c.



Referenced by dir\+\_\+find(), dir\+\_\+register(), f\+\_\+mkfs(), Leap\+\_\+\+Days\+\_\+\+Since\+\_\+1900(), Mat\+Mul(), posix\+\_\+tests(), put\+\_\+lfn(), sum(), and sum\+\_\+sfn().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!testpage@{testpage}}
\index{testpage@{testpage}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{testpage(int count)}{testpage(int count)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int testpage (
\begin{DoxyParamCaption}
\item[{int}]{count}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a568ac783ed7c976d2832966dcbce607c}{}\label{posix__tests_8c_a568ac783ed7c976d2832966dcbce607c}


Used to page output of functions like cat, hexdump, etc. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & file to hexdump  -\/1 = quit, return count or 0 at new page \\
\hline
\end{DoxyParams}


Definition at line 435 of file posix\+\_\+tests.\+c.



Referenced by cat(), and hexdump().

\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!upload@{upload}}
\index{upload@{upload}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{upload(char $\ast$name)}{upload(char *name)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} long upload (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name}
\end{DoxyParamCaption}
)}\hypertarget{posix__tests_8c_a759815811bc60d82eba7fa71442b9d9c}{}\label{posix__tests_8c_a759815811bc60d82eba7fa71442b9d9c}


Capture an A\+S\+C\+II file to sdcard First blank line exits capture. 

F\+I\+X\+ME T\+O\+DO 
\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & file to save on sdcard  void \\
\hline
\end{DoxyParams}


Definition at line 661 of file posix\+\_\+tests.\+c.



Referenced by posix\+\_\+tests().



\subsection{Variable Documentation}
\index{posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}!\+\_\+pagesize@{\+\_\+pagesize}}
\index{\+\_\+pagesize@{\+\_\+pagesize}!posix\+\_\+tests.\+c@{posix\+\_\+tests.\+c}}
\subsubsection[{\texorpdfstring{\+\_\+pagesize}{_pagesize}}]{\setlength{\rightskip}{0pt plus 5cm}int \+\_\+pagesize = 25\hspace{0.3cm}{\ttfamily [static]}}\hypertarget{posix__tests_8c_a8103355735500cb8d1c1eea35e352cda}{}\label{posix__tests_8c_a8103355735500cb8d1c1eea35e352cda}


Used to page output of functions like cat, hexdump, etc. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & file to hexdump  void \\
\hline
\end{DoxyParams}


Definition at line 422 of file posix\+\_\+tests.\+c.



Referenced by setpage(), and testpage().

